

/*
#pragma once

#include "global.h"

class Piece
{
private:
	int m_x, m_y;
	int m_next_x, m_next_y;
	char m_icon;
	int m_color;
	int m_owner;
public:
	Piece()
	{
		m_x = 0;
		m_y = 0;
		m_next_x = 0;
		m_next_y = 0;
		m_icon = 1;
		m_color = 12;
		m_owner = 2;
	}
	void addMotion(int dx, int dy){m_x += dx; m_y += dy;}
	void addNextMove(int dx, int dy){m_next_x += dx; m_next_y += dy;}
	int getX(){return m_x;}
	int getY(){return m_y;}
	void setX(int x){m_x = x;}
	void setY(int y){m_y = y;}
	char getIcon(){return m_icon;}
	void setIcon(char i){m_icon = i;}
	int getColor(){return m_color;}
	void setColor(int c){m_color = c;}
	int getOwner(){return m_owner;}
	void setOwner(int o){m_owner = o;}
	//void setAll(int x, int y, char i, int c){m_x = x; m_y = y; m_icon = i; m_color = c;}
	void draw()
	{
		setConsoleCursor(m_x,m_y);
		setConsoleColor(m_color);
		printf("%c",m_icon);
	}
	void update()
	{
		//if(m_next_x != 0 || m_next_y != 0)
		{
			addMotion(m_next_x, m_next_y);
			m_next_x = 0;
			m_next_y = 0;
		}
	}

};
 */
package javachess;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Point;

public class Piece
{
	Point m_loc = new Point();
	char m_icon;
	int m_next_x, m_next_y;
	int m_color;
	int m_owner;
	int m_x;
	int m_y;
	
	Piece()
	{
		
	}
	
	Piece(char icon, int owner)
	{
		m_icon = icon;
		m_owner = owner;
	}
	
	public void move(int a_x, int a_y)
	{
		m_x = a_x;
		m_y = a_y;
	}

	public void addMotion(int dx, int dy){m_x += dx; m_y += dy;}
	public void addNextMove(int dx, int dy){m_next_x += dx; m_next_y += dy;}
	public int getX(){return m_x;}
	public int getY(){return m_y;}
	public void setX(int x){m_x = x;}
	public void setY(int y){m_y = y;}
	public char getIcon(){return m_icon;}
	public void setIcon(char i){m_icon = i;}
	public int getColor(){return m_color;}
	public void setColor(int c){m_color = c;}
	public int getOwner(){return m_owner;}
	public void setOwner(int o){m_owner = o;}	
	
	public void draw(Graphics g, int w, int h, int s, int c)
	{
		//sets the font
		g.setFont(new Font("Chess-7", Font.PLAIN, w * s));
		//sets the color
		g.setColor(new Color(c));
		//prints the icon at the space given
		g.drawString(Character.toString(m_icon), (m_x * w * s), (m_y * h * s + (h * s)));
	}
}
